home *** CD-ROM | disk | FTP | other *** search
/ Draw 3 / Draw 3.iso / AOL90 / COMP02.000 / %MAINDIR% / CalendarResource.dll / HTML / ACDAYMONTHBODY2.JS < prev    next >
Encoding:
JavaScript  |  2004-11-29  |  9.2 KB  |  379 lines

  1.  
  2.   // day_view = 0, month_view = 1, week_view = 2
  3.     var _monthview_showing = 1;
  4.     var _open_daypopup = false;
  5.     
  6.     //////////////////////////////////////////////////////
  7.     // DoOnDayMonthControllerLoaded
  8.  
  9.     function DoOnDayMonthControllerLoaded()
  10.     {
  11. //        DoOnLoadDayMonthTitle();
  12. //        UpdateDayMonthTitleSize();
  13.  
  14.         //    Make appropriate view visible:
  15.         var iView;
  16.         iView = window.top.external.GetCurrentView();
  17.         if( iView == 1 )
  18.             MakeMonthViewVisible();    
  19.         else if (iView == 0 )
  20.             MakeDayViewVisible();
  21.         else
  22.             MakeWeekViewVisible();
  23.  
  24.         window.onresize = DoOnWindowResize;
  25.     }
  26.  
  27.     //////////////////////////////////////////////////////
  28.     // DoOnWindowResize
  29.  
  30.     function DoOnWindowResize()
  31.     {
  32.         if (_monthview_showing == 0) {
  33.             //DayViewDivUpdateSize();
  34.       }
  35.     }
  36.     
  37.     //////////////////////////////////////////////////////
  38.     // MakeMonthViewVisible
  39.  
  40.     function MakeMonthViewVisible()
  41.     {
  42.         MonthViewDiv.style.visibility = "visible";
  43.         DayViewDiv.style.visibility   = "hidden";
  44.         WeekViewDiv.style.visibility  = "hidden";
  45.  
  46.         // NB: This must be set *before* refreshing the
  47.         // tab and title elements...
  48.         _monthview_showing = 1;
  49.         window.external.TellViewChange(1); //if I use true here, I got a -1 on the C++ side
  50.  
  51.         MonthViewDivRefresh();
  52.         RefreshDayMonthTitle();
  53.         window.focus();
  54.     }
  55.  
  56.     //////////////////////////////////////////////////////
  57.     // MakeDayViewVisible
  58.  
  59.     function MakeDayViewVisible()
  60.     {
  61.         DayViewDiv.style.visibility = "visible";
  62.         MonthViewDiv.style.visibility   = "hidden";
  63.         WeekViewDiv.style.visibility  = "hidden";
  64.  
  65.         // NB: This must be set *before* refreshing the
  66.         // tab and title elements...
  67.         _monthview_showing = 0;
  68.         window.external.TellViewChange(0);
  69.  
  70.         DayViewDivRefresh();
  71.         RefreshDayMonthTitle();
  72.         window.focus();
  73.     }
  74.  
  75.     //////////////////////////////////////////////////////
  76.     // MakeWeekViewVisible
  77.  
  78.     function MakeWeekViewVisible()
  79.     {
  80.         WeekViewDiv.style.visibility  = "visible";
  81.         DayViewDiv.style.visibility = "hidden";
  82.         MonthViewDiv.style.visibility   = "hidden";
  83.  
  84.         // NB: This must be set *before* refreshing the
  85.         // tab and title elements...
  86.         _monthview_showing = 2;
  87.         window.external.TellViewChange(2);
  88.  
  89.         WeekViewDivRefresh();
  90.         RefreshDayMonthTitle();
  91.         window.focus();
  92.     }
  93.  
  94.     //////////////////////////////////////////////////////
  95.     // DayMonthControllerUpdate
  96.  
  97.     function DayMonthControllerUpdate()
  98.     {
  99.         if (_monthview_showing == 1)
  100.             MonthViewDivRefresh();
  101.         else if (_monthview_showing == 0)
  102.             DayViewDivRefresh();
  103.     else
  104.       WeekViewDivRefresh();
  105.  
  106.         RefreshDayMonthTitle();
  107.     }
  108.     //////////////////////////////////////////////////////
  109.     // MonthViewIsVisible
  110.  
  111.     function MonthViewIsVisible()
  112.     {
  113.     if (_monthview_showing == 1)
  114.       return true;
  115.         else
  116.       return false;
  117.     }
  118.  
  119.     //////////////////////////////////////////////////////
  120.     // DayViewIsVisible
  121.  
  122.     function DayViewIsVisible()
  123.     {
  124.         if (_monthview_showing == 0)
  125.       return true;
  126.         else
  127.       return false;
  128.     }
  129.  
  130.     //////////////////////////////////////////////////////
  131.     // WeekViewIsVisible
  132.  
  133.     function WeekViewIsVisible()
  134.     {
  135.         if (_monthview_showing == 2)
  136.       return true;
  137.         else
  138.       return false;
  139.     }
  140.  
  141.    ///////////////////////////////////////////////////////
  142.    // UpdateCurrentDate
  143.  
  144.    function UpdateCurrentDate(year, month, day)
  145.    {
  146.         window.external.SetCurrentDayMonthYear (day, month, year);
  147.         DayViewDivRefresh();
  148.         WeekViewDivRefresh();
  149.         RefreshDayMonthTitle();
  150.    }
  151.  
  152.  
  153.     ///////////////////////////////////////////////////////
  154.     // EscapeSpecialChars
  155.     function EscapeSpecialChars(strText) // called when input data with special chars is obtained from the UI
  156.     {
  157.         var strReturn = strText;
  158.         // use regular expressions for search and replace (note: the order is very important)...
  159.         strReturn = strReturn.replace( /&/gi , "&");
  160.         strReturn = strReturn.replace( /</gi , "<");
  161.         strReturn = strReturn.replace( />/gi , ">");
  162.         strReturn = strReturn.replace( /\"/gi , """);
  163.         return strReturn;
  164.     }
  165.  
  166.     ///////////////////////////////////////////////////////
  167.     // UnescapeSpecialChars
  168.     function UnescapeSpecialChars(strText)    // called when the stored data contains escaped literals and needs to be converted to the raw chars. 
  169.     {
  170.         var strReturn = strText;
  171.         // use regular expressions for search and replace (note: the order is very important)...
  172.         strReturn = strReturn.replace( /&/gi , "&");
  173.         strReturn = strReturn.replace( /</gi , "<");
  174.         strReturn = strReturn.replace( />/gi , ">");
  175.         strReturn = strReturn.replace( /"/gi , "\"");
  176.         return strReturn;
  177.     }
  178.  
  179.  
  180.     ///////////////////////////////////////////////////////
  181.     // ShowLinkedEventDetails
  182.  
  183.     function ShowLinkedEventDetails(eid)
  184.     {
  185.         
  186.         var d = new ActiveXObject("AolCalSvr.ACDictionary.5");
  187.         
  188.         d.Item("kWindow") = window;
  189.         d.Item("kEventID") = eid;
  190.  
  191.         var features = "dialogWidth=421px;dialogHeight=305px;help=no;resizable=no;status=no";
  192.         if (showModalDialog("res:IDH_ACLINKEDEVENTDLG", d, features) != 0)
  193.             DayMonthControllerUpdate();
  194.  
  195.     }
  196.  
  197.  
  198. function DayViewDivRefresh()
  199.     if (bCalendarLoaded != true)
  200.     return;
  201.     DayViewDivUpdateSize();
  202.     UpdateDayView();
  203.     window.document.all.DayViewDiv.InitDLLocation ();
  204. }
  205. function UpdateDayView ()
  206. {
  207.     document.all.DayViewDiv.Refresh();
  208.     DayViewDiv.Refresh();
  209. }
  210.     
  211. function DayViewDivUpdateSize()
  212. {    
  213. }
  214.  
  215. function WeekViewDivUpdateSize()
  216. {    
  217. }
  218.  
  219.  
  220. var bCalendarLoaded = false;
  221.  
  222. function DoOnLoadBody()
  223. {
  224.     DoOnDayMonthControllerLoaded(); 
  225.     window.external.CalendarLoaded();
  226.     bCalendarLoaded = true;
  227. }
  228.  
  229. function MonthViewDivRefresh()
  230. {
  231.     if (bCalendarLoaded == true)
  232.         MonthViewDiv.Refresh();
  233. }
  234.  
  235. function WeekViewDivRefresh()
  236. {
  237.   if (bCalendarLoaded != true)
  238.       return;
  239.   WeekViewDivUpdateSize();
  240.   UpdateWeekView();
  241.   window.document.all.WeekViewDiv.InitDLLocation ();
  242. }
  243. function UpdateWeekView ()
  244. {
  245.     document.all.WeekViewDiv.Refresh();
  246.     WeekViewDiv.Refresh();
  247. }
  248.  
  249. /************************************************************/
  250. // Toolbar functions:
  251. /************************************************************/
  252.  
  253. function RefreshDayMonthTitle()
  254. {
  255.     ToolBarCtrl.RefreshDayMonthTitle();
  256. }
  257. function Refresh( iView )
  258. {
  259.     if( iView == 1)
  260.         MonthViewDiv.Refresh();
  261.     else if (iView == 0)
  262.         DayViewDivRefresh();
  263.   else
  264.     WeekViewDivRefresh();
  265.  
  266.     ToolBarCtrl.RefreshDayMonthTitle();
  267. }
  268.  
  269. //////////////////////////////////////////////////////
  270. // Toolbar Print Button
  271. //This function is obsolete. java script code is replaced by C++ code.
  272. /*
  273. function DoOnClickPrint()
  274. {
  275.  
  276.      var Dict = new ActiveXObject("AolCalSvr.ACDictionary.5");
  277.      
  278.      Dict.Item("kWindow") = window;
  279.      var lReturn
  280.      if (MonthViewIsVisible())
  281.      {
  282.          var features = "dialogWidth=347px;dialogHeight=250px;help=no;resizable=no;status=no";
  283.          lReturn = showModalDialog("res:IDH_ACPRINTMONTHDLG", Dict, features);
  284.          if (lReturn)
  285.              window.external.PrintMonthView(Dict);    
  286.      }
  287.      else
  288.      {
  289.          var features = "dialogWidth=367px;dialogHeight=250px;help=no;resizable=no;status=no";
  290.          lReturn = showModalDialog("res:IDH_ACPRINTDAYDLG", Dict, features);
  291.          if (lReturn)
  292.              window.external.PrintDayView(Dict);
  293.      }
  294.     
  295. }
  296. */
  297.  
  298. function DoOnClickPrint()
  299. {
  300.      var Dict = new ActiveXObject("AolCalSvr.ACDictionary.5");
  301.      
  302.      Dict.Item("kWindow") = window;
  303.      Dict.Item("kPrinterName") = "";  //NULL to show the print dialog
  304.      Dict.Item("kShowPrintDlg") = "true";  //This must be true always
  305.      Dict.Item("kFromClient") = "true";
  306.  
  307.      var lReturn
  308.      if (MonthViewIsVisible())
  309.      {
  310.          window.external.PrintMonthView(Dict);    
  311.      }
  312.      else
  313.      {
  314.          window.external.PrintDayView(Dict);
  315.      }
  316.  
  317. //    DoOnClickPrintEx("rams","true")    ;
  318. }
  319.  
  320. function DoOnClickPrintEx(strPrinterName,strShow)
  321. {
  322.  
  323.      var Dict = new ActiveXObject("AolCalSvr.ACDictionary.5");
  324.      
  325.      Dict.Item("kWindow") = window;
  326.      Dict.Item("kPrinterName") = strPrinterName;  //NULL to show the print dialog
  327.      Dict.Item("kShowPrintDlg") = strShow;  
  328.      Dict.Item("kFromClient") = "true"; //This must be true always
  329.  
  330.      var lReturn
  331.      if (MonthViewIsVisible())
  332.      {
  333.          window.external.PrintMonthView(Dict);    
  334.      }
  335.      else
  336.      {
  337.          window.external.PrintDayView(Dict);
  338.      }
  339.     
  340. }
  341.  
  342. //////////////////////////////////////////////////////
  343. // Accessibility functions
  344.  
  345. function DoStartLocalAccessibleCalendar()
  346. {
  347.      window.external.StartLocalAccessibleCalendar(1);    
  348. }
  349.  
  350. //////////////////////////////////////////////////////
  351. // Toolbar Help Button
  352.  
  353. function DoOnClickHelp()
  354. {
  355.     window.external.AOLGoToOfflineURL ("cal_help.html");
  356. }
  357.  
  358. //////////////////////////////////////////////////////
  359. // Toolbar Settings Button
  360.  
  361. function DoOnClickSettings()
  362. {
  363.     var dict = new ActiveXObject("AolCalSvr.ACDictionary.5");
  364.     dict.Item("kWindow") = window;
  365.  
  366.     var features = "dialogWidth=417px;dialogHeight=245px;";
  367.     features += "help=no;resizable=no;status=no";
  368.  
  369.     var retVal = showModalDialog("res:IDH_ACSETTINGDIALOG", dict, features);
  370.  
  371.     if (retVal)
  372.     {
  373.         if( window.external.InternetConnectionIsOpen() )
  374.             window.external.StartSilentSync();
  375.         DayMonthControllerUpdate();   
  376.     }
  377. }
  378.